package com.lyh.system.service.impl;

import java.lang.reflect.Member;
import java.util.List;
import com.lyh.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lyh.system.mapper.InvitationMapper;
import com.lyh.system.domain.Invitation;
import com.lyh.system.service.IInvitationService;

/**
 * 邀请码信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-28
 */
@Service
public class InvitationServiceImpl implements IInvitationService 
{
    @Autowired
    private InvitationMapper invitationMapper;

    /**
     * 查询邀请码信息
     * 
     * @param id 邀请码信息主键
     * @return 邀请码信息
     */
    @Override
    public Invitation selectInvitationById(Long id)
    {
        return invitationMapper.selectInvitationById(id);
    }

    /**
     * 查询邀请码信息列表
     * 
     * @param invitation 邀请码信息
     * @return 邀请码信息
     */
    @Override
    public List<Invitation> selectInvitationList(Invitation invitation)
    {
        return invitationMapper.selectInvitationList(invitation);
    }

    /**
     * 新增邀请码信息
     * 
     * @param invitation 邀请码信息
     * @return 结果
     */
    @Override
    public int insertInvitation(Invitation invitation)
    {
        invitation.setCreateTime(DateUtils.getNowDate());
        return invitationMapper.insertInvitation(invitation);
    }

    /**
     * 修改邀请码信息
     * 
     * @param invitation 邀请码信息
     * @return 结果
     */
    @Override
    public int updateInvitation(Invitation invitation)
    {
        invitation.setUpdateTime(DateUtils.getNowDate());
        return invitationMapper.updateInvitation(invitation);
    }

    /**
     * 批量删除邀请码信息
     * 
     * @param ids 需要删除的邀请码信息主键
     * @return 结果
     */
    @Override
    public int deleteInvitationByIds(Long[] ids)
    {
        return invitationMapper.deleteInvitationByIds(ids);
    }

    /**
     * 删除邀请码信息信息
     * 
     * @param id 邀请码信息主键
     * @return 结果
     */
    @Override
    public int deleteInvitationById(Long id)
    {
        return invitationMapper.deleteInvitationById(id);
    }

    @Override
    public List<Long> selectInviteeMemberIds(String invitationCode) {
        return invitationMapper.selectInviteeMemberIds(invitationCode);
    }
}
